<!doctype html public "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
<html>
<head>
<title>
 Overview
</title>
<link rel ="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script>
function asd() {
	
		parent.document.title="ColorDialog.js Overview";
	
}
</script>
</head>
<body bgcolor="white" onload="asd();">

<!-- ========== START OF NAVBAR ========== -->
<a name="navbar_top"><!-- --></a>
<table border="0" width="100%" cellpadding="1" cellspacing="0">
<tr>
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
<a name="navbar_top_firstrow"><!-- --></a>
<table border="0" cellpadding="0" cellspacing="3">
  <tr align="center" valign="top">
  
  
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a>&nbsp;</td>
  <td bgcolor="#FFFFFF" class="NavBarCell1Rev">	&nbsp;<font class="NavBarFont1Rev"><b>File</b></font>&nbsp;</td>
  

  <td bgcolor="#FFFFFF" class="NavBarCell1"> 	<font class="NavBarFont1">Class</font>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>
  </tr>
</table>
</td>
<td bgcolor="#EEEEFF" align="right" valign="top">
<em>
<b></b></em>
</td>
</tr>

<tr>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
&nbsp;PREV&nbsp;
&nbsp;NEXT</font></td>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
  <a href="index.html" target="_top"><b>FRAMES</b></a>  &nbsp;
&nbsp;<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
&nbsp;&nbsp;
<script>
  <!--
  if(window==top) {
    document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
  }
  //-->
</script>
<noscript>
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
</noscript>
</font></td>
</tr>
</table>
<!-- =========== END OF NAVBAR =========== -->

<hr>
<center>
	
	   <h2>ColorDialog.js</h2>
	
</center>

	


<h4>Summary</h4>
<p>
	
		No overview generated for 'ColorDialog.js'<BR/><BR/>
	
</p>

<hr>


    <table border="1" cellpadding="3" cellspacing="0" width="100%">
    <tr bgcolor="#CCCCFF" class="TableHeadingColor">
    <td colspan=2><font size="+2">
    
        <b>Class Summary</b>
    
    </font></td>
    </tr>
    
    <tr bgcolor="white" class="TableRowColor">
    <td width="15%"><b><a href="draw2d/ColorDialog.html">draw2d.ColorDialog</a></b></td>
    <td>&nbsp;</td>
    </tr>
    
    </table>
    <hr/> 


<!-- ========== METHOD SUMMARY =========== -->

<!-- ========== END METHOD SUMMARY =========== -->


        <pre class="sourceview"><span class="comment">/* This notice must be untouched at all times.

FreeGroup Draw2D 0.9.26
The latest version is available at
http://www.freegroup.de

Copyright (c) 2006 Andreas Herz. All rights reserved.
Created 5. 11. 2006 by Andreas Herz (Web: http://www.freegroup.de )

LICENSE: LGPL

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License (LGPL) as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA,
or see http://www.gnu.org/copyleft/lesser.html
*/</span>

<span class="comment">/**
 * 
 * <span class="attrib">@version</span> 0.9.26
 * <span class="attrib">@author</span> Andreas Herz
 * <span class="attrib">@constructor</span>
 */</span>
draw2d.ColorDialog=<span class="reserved">function</span>()
{
  <span class="comment">/** <span class="attrib">@private</span> **/</span>
  <span class="reserved">this</span>.maxValue={<span class="literal">'h'</span>:<span class="literal">'359'</span>,<span class="literal">'s'</span>:<span class="literal">'100'</span>,<span class="literal">'v'</span>:<span class="literal">'100'</span>};
  <span class="comment">/** <span class="attrib">@private</span> **/</span>
  <span class="reserved">this</span>.HSV={0:359,1:100,2:100};
  <span class="comment">/** <span class="attrib">@private</span> **/</span>
  <span class="reserved">this</span>.slideHSV={0:359,1:100,2:100};

  <span class="comment">/** <span class="attrib">@private</span> **/</span>
  <span class="reserved">this</span>.SVHeight=165;
  <span class="comment">/** <span class="attrib">@private</span> **/</span>
  <span class="reserved">this</span>.wSV=162;
  <span class="comment">/** <span class="attrib">@private</span> **/</span>
  <span class="reserved">this</span>.wH=162;

  draw2d.Dialog.call(<span class="reserved">this</span>,<span class="literal">"Color Chooser"</span>);

  <span class="reserved">this</span>.loadSV();
  <span class="reserved">this</span>.setColor(new  draw2d.Color(255,0,0));

  <span class="reserved">this</span>.setDimension(219,244);
};

draw2d.ColorDialog.<span class="reserved">prototype</span> = new draw2d.Dialog();
  <span class="comment">/** <span class="attrib">@private</span> **/</span>
draw2d.ColorDialog.<span class="reserved">prototype</span>.type=<span class="literal">"draw2d.ColorDialog"</span>;


<span class="comment">/**
 * <span class="attrib">@private</span>
 **/</span>
draw2d.ColorDialog.<span class="reserved">prototype</span>.createHTMLElement=<span class="reserved">function</span>()
{
  var oThis = <span class="reserved">this</span>;
  var item = draw2d.Dialog.<span class="reserved">prototype</span>.createHTMLElement.call(<span class="reserved">this</span>);

  <span class="reserved">this</span>.outerDiv = document.createElement(<span class="literal">"div"</span>);
  <span class="reserved">this</span>.outerDiv.id=<span class="literal">"plugin"</span>;
  <span class="reserved">this</span>.outerDiv.style.top =<span class="literal">"15px"</span>;
  <span class="reserved">this</span>.outerDiv.style.left =<span class="literal">"0px"</span>;
  <span class="reserved">this</span>.outerDiv.style.width=<span class="literal">"201px"</span>;
  <span class="reserved">this</span>.outerDiv.style.position=<span class="literal">"absolute"</span>;
  <span class="reserved">this</span>.outerDiv.style.padding=<span class="literal">"9px"</span>;
  <span class="reserved">this</span>.outerDiv.display=<span class="literal">"block"</span>;
  <span class="reserved">this</span>.outerDiv.style.background=<span class="literal">"#0d0d0d"</span>;

  <span class="reserved">this</span>.plugHEX = document.createElement(<span class="literal">"div"</span>);
  <span class="reserved">this</span>.plugHEX.id = <span class="literal">"plugHEX"</span>;
  <span class="reserved">this</span>.plugHEX.innerHTML=<span class="literal">"F1FFCC"</span>;
  <span class="reserved">this</span>.plugHEX.style.color=<span class="literal">"white"</span>;
  <span class="reserved">this</span>.plugHEX.style.font=<span class="literal">"normal 10px verdana"</span>;
  <span class="reserved">this</span>.outerDiv.appendChild(<span class="reserved">this</span>.plugHEX);


  <span class="reserved">this</span>.SV = document.createElement(<span class="literal">"div"</span>);
  <span class="reserved">this</span>.SV.onmousedown=<span class="reserved">function</span>(event){oThis.mouseDownSV(oThis.SVslide,event);};
  <span class="reserved">this</span>.SV.id =<span class="literal">"SV"</span>;
  <span class="reserved">this</span>.SV.style.cursor=<span class="literal">"crosshair"</span>;
  <span class="reserved">this</span>.SV.style.background=<span class="literal">"#FF0000 url(SatVal.png)"</span>;
  <span class="reserved">this</span>.SV.style.position=<span class="literal">"absolute"</span>;
  <span class="reserved">this</span>.SV.style.height=<span class="literal">"166px"</span>;
  <span class="reserved">this</span>.SV.style.width=<span class="literal">"167px"</span>;
  <span class="reserved">this</span>.SV.style.marginRight=<span class="literal">"10px"</span>;
  <span class="reserved">this</span>.SV.style.filter=<span class="literal">"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='SatVal.png', sizingMethod='scale')"</span>;
  <span class="reserved">this</span>.SV.style[<span class="literal">'float'</span>]=<span class="literal">"left"</span>;
  <span class="reserved">this</span>.outerDiv.appendChild(<span class="reserved">this</span>.SV);

  <span class="reserved">this</span>.SVslide = document.createElement(<span class="literal">"div"</span>);
  <span class="reserved">this</span>.SVslide.onmousedown=<span class="reserved">function</span>(event){oThis.mouseDownSV(event);};
  <span class="reserved">this</span>.SVslide.style.top = <span class="literal">"40px"</span>;
  <span class="reserved">this</span>.SVslide.style.left= <span class="literal">"40px"</span>;
  <span class="reserved">this</span>.SVslide.style.position=<span class="literal">"absolute"</span>;
  <span class="reserved">this</span>.SVslide.style.cursor=<span class="literal">"crosshair"</span>;
  <span class="reserved">this</span>.SVslide.style.background=<span class="literal">"url(slide.gif)"</span>;
  <span class="reserved">this</span>.SVslide.style.height=<span class="literal">"9px"</span>;
  <span class="reserved">this</span>.SVslide.style.width=<span class="literal">"9px"</span>;
  <span class="reserved">this</span>.SVslide.style.lineHeight=<span class="literal">"1px"</span>;
  <span class="reserved">this</span>.outerDiv.appendChild(<span class="reserved">this</span>.SVslide);

  <span class="reserved">this</span>.H = document.createElement(<span class="literal">"form"</span>);
  <span class="reserved">this</span>.H.id=<span class="literal">"H"</span>;
  <span class="reserved">this</span>.H.onmousedown=<span class="reserved">function</span>(event){oThis.mouseDownH(event);};
  <span class="reserved">this</span>.H.style.border=<span class="literal">"1px solid #000000"</span>;
  <span class="reserved">this</span>.H.style.cursor=<span class="literal">"crosshair"</span>;
  <span class="reserved">this</span>.H.style.position=<span class="literal">"absolute"</span>;
  <span class="reserved">this</span>.H.style.width=<span class="literal">"19px"</span>;
  <span class="reserved">this</span>.H.style.top=<span class="literal">"28px"</span>;
  <span class="reserved">this</span>.H.style.left=<span class="literal">"191px"</span>;
  <span class="reserved">this</span>.outerDiv.appendChild(<span class="reserved">this</span>.H);

  <span class="reserved">this</span>.Hslide = document.createElement(<span class="literal">"div"</span>);
  <span class="reserved">this</span>.Hslide.style.top = <span class="literal">"-7px"</span>;
  <span class="reserved">this</span>.Hslide.style.left= <span class="literal">"-8px"</span>;
  <span class="reserved">this</span>.Hslide.style.background= <span class="literal">"url(slideHue.gif)"</span>;
  <span class="reserved">this</span>.Hslide.style.height= <span class="literal">"5px"</span>;
  <span class="reserved">this</span>.Hslide.style.width = <span class="literal">"33px"</span>;
  <span class="reserved">this</span>.Hslide.style.position= <span class="literal">"absolute"</span>;
  <span class="reserved">this</span>.Hslide.style.lineHeight= <span class="literal">"1px"</span>;
  <span class="reserved">this</span>.H.appendChild(<span class="reserved">this</span>.Hslide);

  <span class="reserved">this</span>.Hmodel = document.createElement(<span class="literal">"div"</span>);
  <span class="reserved">this</span>.Hmodel.style.height= <span class="literal">"1px"</span>;
  <span class="reserved">this</span>.Hmodel.style.width= <span class="literal">"19px"</span>;
  <span class="reserved">this</span>.Hmodel.style.lineHeight= <span class="literal">"1px"</span>;
  <span class="reserved">this</span>.Hmodel.style.margin= <span class="literal">"0px"</span>;
  <span class="reserved">this</span>.Hmodel.style.padding= <span class="literal">"0px"</span>;
  <span class="reserved">this</span>.Hmodel.style.fontSize= <span class="literal">"1px"</span>;
  <span class="reserved">this</span>.H.appendChild(<span class="reserved">this</span>.Hmodel);

  item.appendChild(<span class="reserved">this</span>.outerDiv);

  <span class="reserved">return</span> item;
};

<span class="comment">/**
 *
 **/</span>
draw2d.ColorDialog.<span class="reserved">prototype</span>.onOk=<span class="reserved">function</span>()
{
  draw2d.Dialog.<span class="reserved">prototype</span>.onOk.call(<span class="reserved">this</span>);
};



draw2d.browser=<span class="reserved">function</span>(v) { <span class="reserved">return</span>(Math.max(navigator.userAgent.toLowerCase().indexOf(v),0)); }

<span class="comment">/**
 * <span class="attrib">@private</span>
 **/</span>
draw2d.ColorDialog.<span class="reserved">prototype</span>.showColor=<span class="reserved">function</span>(c)
{
  <span class="reserved">this</span>.plugHEX.style.background=<span class="literal">"#"</span>+c;
  <span class="reserved">this</span>.plugHEX.innerHTML=c;
};

<span class="comment">/**
 * <span class="attrib">@private</span>
 **/</span>
draw2d.ColorDialog.<span class="reserved">prototype</span>.getSelectedColor=<span class="reserved">function</span>()
{
  var rgb = <span class="reserved">this</span>.hex2rgb(<span class="reserved">this</span>.plugHEX.innerHTML);
  <span class="reserved">return</span> new  draw2d.Color(rgb[0],rgb[1],rgb[2]);
};

<span class="comment">/**
 * <span class="attrib">@private</span>
 **/</span>
draw2d.ColorDialog.<span class="reserved">prototype</span>.setColor=<span class="reserved">function</span>(<span class="comment">/*:draw2d.Color*/</span> color)
{
  <span class="reserved">if</span>(color===null)
    color = new  draw2d.Color(100,100,100);
  var hex = <span class="reserved">this</span>.rgb2hex(Array(color.getRed(),color.getGreen(),color.getBlue()));
  <span class="reserved">this</span>.updateH(hex);
};

<span class="comment">/**
 * <span class="attrib">@private</span>
 **/</span>
draw2d.ColorDialog.<span class="reserved">prototype</span>.XY=<span class="reserved">function</span>(e,v)
{ 
  var z=draw2d.browser(<span class="literal">'msie'</span>)?Array(event.clientX+document.body.scrollLeft,event.clientY+document.body.scrollTop):Array(e.pageX,e.pageY); 
  <span class="reserved">return</span> z[v];
};

<span class="comment">/**
 * <span class="attrib">@private</span>
 **/</span>
draw2d.ColorDialog.<span class="reserved">prototype</span>.mkHSV=<span class="reserved">function</span>(a,b,c) 
{
    <span class="reserved">return</span>(Math.min(a,Math.max(0,Math.ceil((parseInt(c)/b)*a)))); 
};

<span class="comment">/**
 * <span class="attrib">@private</span>
 **/</span>
draw2d.ColorDialog.<span class="reserved">prototype</span>.ckHSV=<span class="reserved">function</span>(a,b)
{
  <span class="reserved">if</span>(a&gt;=0 &amp;&amp; a&lt;=b)
    <span class="reserved">return</span>(a); 
  <span class="reserved">else</span> <span class="reserved">if</span>(a&gt;b) 
    <span class="reserved">return</span>(b); 
  <span class="reserved">else</span> <span class="reserved">if</span>(a&lt;0)
    <span class="reserved">return</span>(<span class="literal">'-'</span>+oo);
};

<span class="comment">/**
 * <span class="attrib">@private</span>
 **/</span>
draw2d.ColorDialog.<span class="reserved">prototype</span>.mouseDownH=<span class="reserved">function</span>(e)
{
    <span class="reserved">this</span>.slideHSV[0]=<span class="reserved">this</span>.HSV[0];
    var oThis = <span class="reserved">this</span>;
    <span class="reserved">this</span>.H.onmousemove=<span class="reserved">function</span>(e){oThis.dragH(e);};
    <span class="reserved">this</span>.H.onmouseup=<span class="reserved">function</span>(e){oThis.H.onmousemove=<span class="literal">''</span>; oThis.H.onmouseup=<span class="literal">''</span>;};
    <span class="reserved">this</span>.dragH(e);
};

<span class="comment">/**
 * <span class="attrib">@private</span>
 **/</span>
draw2d.ColorDialog.<span class="reserved">prototype</span>.dragH=<span class="reserved">function</span>(e)
{
    var y=<span class="reserved">this</span>.XY(e,1)-<span class="reserved">this</span>.getY()-40;
    <span class="reserved">this</span>.Hslide.style.top=(<span class="reserved">this</span>.ckHSV(y,<span class="reserved">this</span>.wH)-5)+<span class="literal">'px'</span>; 
    <span class="reserved">this</span>.slideHSV[0]=<span class="reserved">this</span>.mkHSV(359,<span class="reserved">this</span>.wH,<span class="reserved">this</span>.Hslide.style.top);
    <span class="reserved">this</span>.updateSV();
    <span class="reserved">this</span>.showColor(<span class="reserved">this</span>.commit());
    <span class="reserved">this</span>.SV.style.backgroundColor=<span class="literal">'#'</span>+<span class="reserved">this</span>.hsv2hex(Array(<span class="reserved">this</span>.HSV[0],100,100));
};

<span class="comment">/**
 * <span class="attrib">@private</span>
 **/</span>
draw2d.ColorDialog.<span class="reserved">prototype</span>.mouseDownSV=<span class="reserved">function</span>(o,e)
{
    <span class="reserved">this</span>.slideHSV[0]=<span class="reserved">this</span>.HSV[0];
    var oThis = <span class="reserved">this</span>;
    <span class="reserved">function</span> reset()
    {
       oThis.SV.onmousemove=<span class="literal">''</span>; 
       oThis.SV.onmouseup=<span class="literal">''</span>;
       oThis.SVslide.onmousemove=<span class="literal">''</span>; 
       oThis.SVslide.onmouseup=<span class="literal">''</span>; 
    };
    <span class="reserved">this</span>.SV.onmousemove=<span class="reserved">function</span>(e){oThis.dragSV(e);};
    <span class="reserved">this</span>.SV.onmouseup=reset;
    <span class="reserved">this</span>.SVslide.onmousemove=<span class="reserved">function</span>(e){oThis.dragSV(e);};
    <span class="reserved">this</span>.SVslide.onmouseup=reset;

    <span class="reserved">this</span>.dragSV(e);
};

<span class="comment">/**
 * <span class="attrib">@private</span>
 **/</span>
draw2d.ColorDialog.<span class="reserved">prototype</span>.dragSV=<span class="reserved">function</span>( e)
{
    var x=<span class="reserved">this</span>.XY(e,0)-<span class="reserved">this</span>.getX()-1;
    var y=<span class="reserved">this</span>.XY(e,1)-<span class="reserved">this</span>.getY()-20;
    <span class="reserved">this</span>.SVslide.style.left=<span class="reserved">this</span>.ckHSV(x,<span class="reserved">this</span>.wSV)+<span class="literal">'px'</span>; 
    <span class="reserved">this</span>.SVslide.style.top=<span class="reserved">this</span>.ckHSV(y,<span class="reserved">this</span>.wSV)+<span class="literal">'px'</span>;
    <span class="reserved">this</span>.slideHSV[1]=<span class="reserved">this</span>.mkHSV(100,<span class="reserved">this</span>.wSV,<span class="reserved">this</span>.SVslide.style.left); 
    <span class="reserved">this</span>.slideHSV[2]=100-<span class="reserved">this</span>.mkHSV(100,<span class="reserved">this</span>.wSV,<span class="reserved">this</span>.SVslide.style.top); 
    <span class="reserved">this</span>.updateSV();
};


<span class="comment">/**
 * <span class="attrib">@private</span>
 **/</span>
draw2d.ColorDialog.<span class="reserved">prototype</span>.commit=<span class="reserved">function</span>()
{
  var r=<span class="literal">'hsv'</span>;
  var z={};
  var j=<span class="literal">''</span>;
  <span class="reserved">for</span>(var i=0; i&lt;=r.length-1; i++) 
  {
    j=r.substr(i,1);
    z[i]=(j==<span class="literal">'h'</span>)?<span class="reserved">this</span>.maxValue[j]-<span class="reserved">this</span>.mkHSV(<span class="reserved">this</span>.maxValue[j],<span class="reserved">this</span>.wH,<span class="reserved">this</span>.Hslide.style.top):<span class="reserved">this</span>.HSV[i];
  }
  <span class="reserved">return</span>(<span class="reserved">this</span>.updateSV(<span class="reserved">this</span>.hsv2hex(z)));
};


<span class="comment">/**
 * <span class="attrib">@private</span>
 **/</span>
draw2d.ColorDialog.<span class="reserved">prototype</span>.updateSV=<span class="reserved">function</span>(v) 
{
  <span class="reserved">this</span>.HSV=v?<span class="reserved">this</span>.hex2hsv(v):Array(<span class="reserved">this</span>.slideHSV[0],<span class="reserved">this</span>.slideHSV[1],<span class="reserved">this</span>.slideHSV[2]);
  <span class="reserved">if</span>(!v)
    v=<span class="reserved">this</span>.hsv2hex(Array(<span class="reserved">this</span>.slideHSV[0],<span class="reserved">this</span>.slideHSV[1],<span class="reserved">this</span>.slideHSV[2]));
  <span class="reserved">this</span>.showColor(v);
  <span class="reserved">return</span> v;
};

<span class="comment">/**
 * <span class="attrib">@private</span>
 **/</span>
draw2d.ColorDialog.<span class="reserved">prototype</span>.loadSV=<span class="reserved">function</span>() 
{ 
  var z=<span class="literal">''</span>;
  <span class="reserved">for</span>(var i=<span class="reserved">this</span>.SVHeight; i&gt;=0; i--)
    z+=<span class="literal">"&lt;div style=\"</span>background:#<span class="literal">"+this.hsv2hex(Array(Math.round((359/this.SVHeight)*i),100,100))+"</span>;\<span class="literal">"&gt;&lt;br/&gt;&lt;\/div&gt;"</span>;
  <span class="reserved">this</span>.Hmodel.innerHTML=z;
};

<span class="comment">/**
 * <span class="attrib">@private</span>
 **/</span>
draw2d.ColorDialog.<span class="reserved">prototype</span>.updateH=<span class="reserved">function</span>(v) 
{ 
  <span class="reserved">this</span>.plugHEX.innerHTML=v;
  <span class="reserved">this</span>.HSV=<span class="reserved">this</span>.hex2hsv(v);
  <span class="reserved">this</span>.SV.style.backgroundColor=<span class="literal">'#'</span>+<span class="reserved">this</span>.hsv2hex(Array(<span class="reserved">this</span>.HSV[0],100,100)); 
  <span class="reserved">this</span>.SVslide.style.top= (parseInt(<span class="reserved">this</span>.wSV-<span class="reserved">this</span>.wSV*(<span class="reserved">this</span>.HSV[1]/100))+20)+<span class="literal">'px'</span>;
  <span class="reserved">this</span>.SVslide.style.left=(parseInt(<span class="reserved">this</span>.wSV*(<span class="reserved">this</span>.HSV[1]/100))+5)+<span class="literal">'px'</span>;
  <span class="reserved">this</span>.Hslide.style.top=(parseInt(<span class="reserved">this</span>.wH*((<span class="reserved">this</span>.maxValue[<span class="literal">'h'</span>]-<span class="reserved">this</span>.HSV[0])/<span class="reserved">this</span>.maxValue[<span class="literal">'h'</span>]))-7)+<span class="literal">'px'</span>;
};


<span class="comment">/**
 * <span class="attrib">@private</span>
 **/</span>
draw2d.ColorDialog.<span class="reserved">prototype</span>.toHex=<span class="reserved">function</span>(v) 
{
  v=Math.round(Math.min(Math.max(0,v),255));
  <span class="reserved">return</span>(<span class="literal">"0123456789ABCDEF"</span>.charAt((v-v%16)/16)+<span class="literal">"0123456789ABCDEF"</span>.charAt(v%16));
};

<span class="comment">/**
 * <span class="attrib">@private</span>
 **/</span>
draw2d.ColorDialog.<span class="reserved">prototype</span>.hex2rgb=<span class="reserved">function</span>(r) 
{
  <span class="reserved">return</span>(
         {0:parseInt(r.substr(0,2),16),
          1:parseInt(r.substr(2,2),16),
          2:parseInt(r.substr(4,2),16)}
         );
};

<span class="comment">/**
 * <span class="attrib">@private</span>
 **/</span>
draw2d.ColorDialog.<span class="reserved">prototype</span>.rgb2hex=<span class="reserved">function</span>(r) 
{ 
  <span class="reserved">return</span>(<span class="reserved">this</span>.toHex(r[0])+<span class="reserved">this</span>.toHex(r[1])+<span class="reserved">this</span>.toHex(r[2])); 
};

<span class="comment">/**
 * <span class="attrib">@private</span>
 **/</span>
draw2d.ColorDialog.<span class="reserved">prototype</span>.hsv2hex=<span class="reserved">function</span>(h) 
{ 
  <span class="reserved">return</span>(<span class="reserved">this</span>.rgb2hex(<span class="reserved">this</span>.hsv2rgb(h))); 
};

<span class="comment">/**
 * <span class="attrib">@private</span>
 **/</span>
draw2d.ColorDialog.<span class="reserved">prototype</span>.hex2hsv=<span class="reserved">function</span>(v) 
{
  <span class="reserved">return</span>(<span class="reserved">this</span>.rgb2hsv(<span class="reserved">this</span>.hex2rgb(v)));
};

<span class="comment">/**
 * <span class="attrib">@private</span>
 **/</span>
draw2d.ColorDialog.<span class="reserved">prototype</span>.rgb2hsv=<span class="reserved">function</span>(r)
{
  var max=Math.max(r[0],r[1],r[2]);
  var delta=max-Math.min(r[0],r[1],r[2]);
  var H;
  var S;
  var V;

  <span class="reserved">if</span>(max!=0) 
  { 
    S=Math.round(delta/max*100);
    <span class="reserved">if</span>(r[0]==max)
      H=(r[1]-r[2])/delta;
    <span class="reserved">else</span> <span class="reserved">if</span>(r[1]==max)
      H=2+(r[2]-r[0])/delta;
    <span class="reserved">else</span> <span class="reserved">if</span>(r[2]==max)
      H=4+(r[0]-r[1])/delta;
    var H=Math.min(Math.round(H*60),360);
    <span class="reserved">if</span>(H&lt;0) 
      H+=360;
   }
   <span class="reserved">return</span>({0:H?H:0,1:S?S:0,2:Math.round((max/255)*100)});
};

<span class="comment">/**
 * <span class="attrib">@private</span>
 **/</span>
draw2d.ColorDialog.<span class="reserved">prototype</span>.hsv2rgb=<span class="reserved">function</span>(r) 
{
  var R;
  var B;
  var G;
  var S=r[1]/100;
  var V=r[2]/100;
  var H=r[0]/360;
  <span class="reserved">if</span>(S&gt;0) 
  { 
    <span class="reserved">if</span>(H&gt;=1) 
      H=0;

    H=6*H; 
    F=H-Math.floor(H);
    A=Math.round(255*V*(1.0-S));
    B=Math.round(255*V*(1.0-(S*F)));
    C=Math.round(255*V*(1.0-(S*(1.0-F))));
    V=Math.round(255*V); 

    switch(Math.floor(H)) 
    {
      case 0: R=V; G=C; B=A; break;
      case 1: R=B; G=V; B=A; break;
      case 2: R=A; G=V; B=C; break;
      case 3: R=A; G=B; B=V; break;
      case 4: R=C; G=A; B=V; break;
      case 5: R=V; G=A; B=B; break;
    }
    <span class="reserved">return</span>({0:R?R:0,1:G?G:0,2:B?B:0});
  }
  <span class="reserved">else</span> 
    <span class="reserved">return</span>({0:(V=Math.round(V*255)),1:V,2:V});
};</pre>
	<hr>



<!-- ========== START OF NAVBAR ========== -->
<a name="navbar_top"><!-- --></a>
<table border="0" width="100%" cellpadding="1" cellspacing="0">
<tr>
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
<a name="navbar_top_firstrow"><!-- --></a>
<table border="0" cellpadding="0" cellspacing="3">
  <tr align="center" valign="top">
  
  
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a>&nbsp;</td>
  <td bgcolor="#FFFFFF" class="NavBarCell1Rev">	&nbsp;<font class="NavBarFont1Rev"><b>File</b></font>&nbsp;</td>
  

  <td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>
  </tr>
</table>
</td>
<td bgcolor="#EEEEFF" align="right" valign="top"><em>
<b></b></em>
</td>
</tr>

<tr>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
&nbsp;PREV&nbsp;
&nbsp;NEXT</font></td>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
  <a href="index.html" target="_top"><b>FRAMES</b></a>  &nbsp;
&nbsp;<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
&nbsp;&nbsp;
<script>
  <!--
  if(window==top) {
    document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
  }
  //-->
</script>
<noscript>
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
</noscript>
</font></td>
</tr>
</table>
<!-- =========== END OF NAVBAR =========== -->

<hr>
<font size="-1">

</font>
<div class="jsdoc_ctime">Documentation generated by <a href="http://jsdoc.sourceforge.net/" target="_parent">JSDoc</a> on Mon Nov 14 13:45:39 2011</div>
</body>
</html>
